﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
using UmcProvider.Shared;
using UmcProvider.PropertiesDesign;
using UmcControls.DesignInterface;

namespace Wicresoft.Shell.Package.AppExp.ToolboxControl
{
    [Designer(typeof(UmcDesigner<IRadioButton>))]
    [DisplayName("RadioButton")]
    [Description("Umc custom RadioButton.")]
    [ToolboxItem(true)]
    [ToolboxBitmap(typeof(System.Windows.Forms.RadioButton), "RadioButton.bmp")]
    [UmcContorlGoupName("UMC Common Controls")]
    public class RadioButton : System.Windows.Forms.RadioButton , IUmcPropertyStore
    {
        //store the properties parse from code which is not surpported by designer
        //also store the properties which is set value using script variable
        //users should operator the dic through the IUmcPropertyStore
        private Dictionary<string, string> DesignViewUnSurpportProperty = new Dictionary<string, string>();

        #region IUmcPropertyStore Members

        public void AddUmcProperty(string property, string value)
        {
            DesignViewUnSurpportProperty.Add(property, value);
        }

        public void RemoveUmcProperty(string property)
        {
            DesignViewUnSurpportProperty.Remove(property);
        }

        public void RemoveAllUmcProperties()
        {
            DesignViewUnSurpportProperty.Clear();
        }

        public string GetUmcProperty(string property)
        {
            if (DesignViewUnSurpportProperty.ContainsKey(property))
            {
                return DesignViewUnSurpportProperty[property];
            }
            else
            {
                return null;
            }
        }

        public List<KeyValuePair<string, string>> GetUmcPropertyList()
        {
            return DesignViewUnSurpportProperty.ToList();
        }


        #endregion
    }


    public sealed class UmcRadioButton : DefaultConverter<UmcRadioButton, RadioButton>, IRadioButton
    {
        #region IRadioButton Members

        public string Name
        {
            get { throw new NotImplementedException(); }
        }

        public bool Enabled
        {
            get { throw new NotImplementedException(); }
        }

        public Size Size
        {
            get { throw new NotImplementedException(); }
        }

        public Point Location
        {
            get { throw new NotImplementedException(); }
        }

        public string Text
        {
            get { throw new NotImplementedException(); }
        }

        public Color BackColor
        {
            get { throw new NotImplementedException(); }
        }

        public Font Font
        {
            get { throw new NotImplementedException(); }
        }

        public Color ForeColor
        {
            get { throw new NotImplementedException(); }
        }

        public bool Checked
        {
            get { throw new NotImplementedException(); }
        }

        #endregion
    }


    public interface IRadioButton : IUmc
    {
        string Name { get; }
        bool Enabled { get; }
        Size Size { get; }
        Point Location { get; }
        string Text { get; }
        Color BackColor { get; }
        Font Font { get; }
        Color ForeColor { get; }
        bool Checked { get; }
    }

}

